package org.peacewing.swingui;

import java.util.List;

import org.light.domain.ValidateInfo;
import org.light.exception.ValidateException;


public class CompileAction {

	public String compilePack(String sgscode) throws Exception {
		try {
			String sourcefolder = getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
			sourcefolder = sourcefolder.replaceAll("\\*", "/");
			if (sourcefolder.contains("/")) {
				sourcefolder = sourcefolder.substring(0, sourcefolder.lastIndexOf("/"));
				sourcefolder = sourcefolder + "/source/";
				return "success";
			}else{
				throw new ValidateException("输出文件夹错误");
			}
		}catch(Exception e){
			if (!(e instanceof ValidateException)) {
				e.printStackTrace();
				Exception ex= new Exception(e.getMessage());
				throw ex;
			}else{
				throw e;
			}
		}
	}
	
	public String ignoreWarningAndCompilePack(String sgscode) throws Exception {
			return "success";
	}
}
